/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package javagameengine;

/**
 *
 * @author jimi
 */
public class Point
{

	public double x, y, z;

	public Point()
	{
		x = 0;
		y = 0;
		z = 0;
	}

	public Point( double a, double b, double c )
	{
		x = a;
		y = b;
		z = c;
	}

	public Point get_render()
	{
		Point p = new Point( this );

		double zoom = p.z - RenderScreen.current.camera.z;

		if( zoom == 0 )
		{
			zoom = 1;
		}

		p.y = -y / zoom;
		p.x = x / zoom;
		p.z = 0;

		return p;
	}

	public Point( Point other )
	{
		x = other.x;
		y = other.y;
		z = other.z;
	}

	public Point negative()
	{
		Point p = new Point();

		p.x = -x;
		p.y = -y;
		p.z = -z;

		return p;
	}

	public Point times( double scalar )
	{
		Point p = new Point();

		p.x = x * scalar;
		p.y = y * scalar;
		p.z = z * scalar;

		return p;
	}

	public Point plus( Point other )
	{
		Point p = new Point();

		p.x = x + other.x;
		p.y = y + other.y;
		p.z = z + other.z;

		return p;
	}

	public Point plus( Vector v )
	{
		return new Point( x + v.x, y + v.y, z + v.z );
	}

	public Vector minus( Point other )
	{
		return new Vector( x - other.x, y - other.y, z - other.z );
	}

	public Vector to_vector()
	{
		return new Vector( x, y, z );
	}
}
